package com.bdqn.interceptor;

import com.bdqn.dto.ApiResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionHandleT01 {

    @ExceptionHandler(Exception.class)
    @ResponseBody//返回json数据给前端
    public ApiResult handlerException(Exception e){
        e.printStackTrace();
        return new ApiResult(500,e.toString(),null);
    }

}
